/**
 * @file record.h
 * @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
 */

#ifndef CX_DEBUG_H
#define CX_DEBUG_H

#ifdef __cplusplus
extern "C" {
#endif

#include <ulog/ulog.h>

#ifndef CHECK_PARAM
#define CHECK_PARAM(x, ret) \
	do { \
		if (!(x)) { \
			LOGW(TAG, "param check failed %s, %d, val=%d.\n", __FUNCTION__, __LINE__, x); \
			return ret; \
		}\
	} while (0)
#endif

#ifndef CHECK_RET_WITH_GOTO
#define CHECK_RET_WITH_GOTO(x, label) \
	do { \
		if (!(x)) { \
			LOGE(TAG, "%s, %d fail.\n", __FUNCTION__, __LINE__); \
			goto label; \
		}\
	} while (0)
#endif

#ifndef CHECK_RET_WITH_RET
#define CHECK_RET_WITH_RET(x, ret) \
	do { \
		if (!(x)) { \
			LOGE(TAG, "%s, %d fail.\n", __FUNCTION__, __LINE__); \
			return ret; \
		}\
	} while (0)
#endif


/** @} */

#ifdef __cplusplus
}
#endif

#endif /* CX_DEBUG_H */

